import os



def filterAllFile():
    dir  = '/Users/jiufenshiren/data/accountFiles/jixin_sftp'
    listdir = os.listdir(dir)
    listdir.sort()
    count = 0
    for datedir in listdir:
        # print(datedir)
        if datedir.find('.DS_Store') == 0:
            continue
        # 小于20250126的不处理
        if int(datedir) < 20250126:
            continue
        filedir = os.listdir(os.path.join(dir, datedir))
        for file in filedir:
            if file.find('.DS_Store') == 0:
                continue
            if file.find('OFFSET_PLAN_DETAIL') != -1: # 不等于-1，就是匹配到了
                # print(file)
                with open(os.path.join(dir, datedir, file), 'rb') as f:
                    while True:
                        line = f.readline()
                        if not line:
                            break
                        repayData = line.decode()
                        split = repayData.split("|")
                        print(split[1])
                        count = count + 1

    print(count)

if __name__ == '__main__':
    filterAllFile()

